package tarantula.instrumenter;

import junit.framework.TestCase;

public class CodeTransformTest extends TestCase {
	
	public void testMustFail1() {
		throwException();
	}
	
	public void testMustFail2() {
		assertionFail();
	}
	
	public void testMustFailTransformed() throws Throwable {
		//call turn on instrumenation
		boolean isFailed = false;
		try {
			throwException();
		} catch (Throwable e) {
			isFailed = true;
			throw e;
		}  finally {
			System.out.println("is failed: " + isFailed);
			//call flush here
		}
	}
	
	public void testMustFail2Transformed() throws Throwable {
		//call turn on instrumenation
		boolean isFailed = false;
		try {
			assertionFail();
		} catch (Throwable e) {
			isFailed = true;
			throw e;
		}  finally {
			System.out.println("is failed: " + isFailed);
			//call flush here
		}
	}
	
	private void throwException() {
		throw new RuntimeException("Hello");
	}
	
	private void assertionFail() {
		assertTrue(false);
	}
}